/*
 * EasyBounceRankView.cpp
 *
 *  Created on: 2009-3-14
 *      Author: Wayne
 */

// INCLUDE FILES
#include <coemain.h>
#include <viewcli.h>
#include <aknviewappui.h>
#include <aknmessagequerydialog.h>
#include <aknnotewrappers.h>
#include <stringloader.h>
#include <EasyBounce.rsg>

#include "EasyBounceRankView.h"
#include "EasyBounceRankContainer.h"
#include "EasyBounce.hrh"

// ============================ MEMBER FUNCTIONS ===============================

// ---------------------------------------------------------
// CFileFavorRankView::ConstructL(const TRect& aRect)
// EPOC two-phased constructor
// ---------------------------------------------------------
//
void CEasyBounceRankView::ConstructL()
    {
    BaseConstructL( R_EB_RANKVIEW );
    }

// ---------------------------------------------------------
// ---------------------------------------------------------
//
CEasyBounceRankView::CEasyBounceRankView()
	{
	
	}

// ---------------------------------------------------------
// CEasyBounceRankView::~CEasyBounceRankView()
// Default destructor
// ---------------------------------------------------------
//
CEasyBounceRankView::~CEasyBounceRankView()
    {
    if ( iContainer )
        {
        AppUi()->RemoveFromViewStack( *this, iContainer );
        }

    delete iContainer;
    }

// ---------------------------------------------------------
// TUid CEasyBounceRankView::Id()
// This returns the view ID
// ---------------------------------------------------------
//
TUid CEasyBounceRankView::Id() const
    {
    return KRankViewId;
    }

// ---------------------------------------------------------
// CEasyBounceRankView::HandleCommandL(TInt aCommand)
// Here we handle commands for this view. 
// Each view has their own HandleCommandL()
// ---------------------------------------------------------
//
void CEasyBounceRankView::HandleCommandL(TInt aCommand)
    {   
    switch ( aCommand )
        {
		case EAknSoftkeyBack:
			AppUi()->ActivateLocalViewL( TUid::Uid( EMainViewId ) );
			break;
        default:
            {
            AppUi()->HandleCommandL( aCommand );
            break;
            }
        }
    }

// ---------------------------------------------------------
// CEasyBounceRankView::HandleClientRectChange()
// ---------------------------------------------------------
//
void CEasyBounceRankView::HandleClientRectChange()
    {
    iContainer->SetRect( ClientRect() );
    }

// ---------------------------------------------------------
// CEasyBounceRankView::DoActivateL(...)
// This is called when a view needs to be activated. 
// This creates container with its controls.
// It also receives messages sent to the view.
// aPrevViewId is passed s.t. we can return to the previous view.
// aCustomMessageId is an ID for the message.
// aCustomMessage is the actual message.
// ---------------------------------------------------------
//
void CEasyBounceRankView::DoActivateL(
   const TVwsViewId& /*aPrevViewId*/, TUid /*aCustomMessageId*/,
   const TDesC8& /*aCustomMessage*/)
    {
    if (!iContainer)
        {
        iContainer = new (ELeave) CEasyBounceRankContainer ( this );
        iContainer->SetMopParent( this );
        iContainer->ConstructL( ClientRect() );
        AppUi()->AddToStackL( *this, iContainer );
        } 
   }

// ---------------------------------------------------------
// CEasyBounceRankView::HandleCommandL(TInt aCommand)
// This is called when a view needs to be deactivated. 
// This destroys container with its controls.
// ---------------------------------------------------------
//
void CEasyBounceRankView::DoDeactivate()
    {
    if ( iContainer )
        {
        AppUi()->RemoveFromViewStack( *this, iContainer );
        }
    delete iContainer;
    iContainer = NULL;
    }

// ---------------------------------------------------------
// CEasyBounceRankView::UpdateCBA
// Update CBA of Rank View. 
// Judge by the iContainer.
// ---------------------------------------------------------
//
void CEasyBounceRankView::UpdateCbaL()
	{
    // Implement this when there are 2 containers or more
	}

// End of File

